Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add FixKw, a companion to Fix{N} #55711

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

matthias314
Copy link
Contributor

Keyword arguments are mentioned several times in the discussion of the recent Fix{N} PR #54653. However, support for them was dropped in the end. I don't know if that was to keep Fix{N} simple or for more fundamental reasons. I would like to propose FixKw as a way to do for keyword arguments what Fix{N} does for positional arguments. I think it should exist for the sake of completeness. It is also helpful because map, reduce and the like don't allow to pass keyword arguments to the function one uses.

I've chosen the name FixKw to resemble Fix although the "fixed" keyword arguments can still be overridden. I'm open to other names.

Please let me know what you think. If you like it, I can add tests and update NEWS.md.

@Roger-luo
Copy link
Contributor

Should this extend Fix instead of having a new struct? E.g if we consider the senario of fixing kwargs it's also possible to fix some args and some kwargs.

@matthias314
Copy link
Contributor Author

That's of course debatable. However, if one wants to fix two positional arguments, then there is also no functionality at present to combine them. FixKw allows to combine several keyword arguments because that's not more complicated than a single one.

@nsajko nsajko added feature Indicates new feature / enhancement requests design Design of APIs or of the language itself needs tests Unit tests are required for this change labels Sep 8, 2024
@matthias314
Copy link
Contributor Author

Are you interested in moving forward with this?

I think that there should be some functionality to fix keyword arguments, be it this proposal or some other solution.

@nsajko nsajko added the needs news A NEWS entry is required for this change label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Design of APIs or of the language itself feature Indicates new feature / enhancement requests needs news A NEWS entry is required for this change needs tests Unit tests are required for this change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants